<template>
  <div v-show="visible" class="column-stat-tooltip" :style="tooltipStyle">
    <div class="title">
      <slot name="title"></slot>
    </div>
    <div class="content">
      <slot name="content"></slot>
    </div>
  </div>
</template>

<script lang="ts">
import { Vue, Component, Prop} from 'vue-property-decorator'

@Component
export default class ColumnStatTooltip extends Vue {
  @Prop() visible?: boolean
  @Prop() tooltipStyle?: any
  mounted() {
    document.body.append(this.$el)
  }

  beforeDestroy() {
    this.$el.remove()
  }
}
</script>

<style lang="less" scoped>
.column-stat-tooltip {
  background-color: #fff;
  border: 1px solid rgba(88, 98, 230, 0.2);
  box-shadow: 0 0 4px 0 rgba(88, 98, 230, 0.2);
  font-size: 12px;
  line-height: 24px;
  padding: 8px 12px;
  position: absolute;
  transition: all 0.1s linear;
  z-index: 1999;
}
</style>